package com.hanter.demo.memoryleak;

import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;

public class TestActivity extends AppCompatActivity {

    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);

            Toast.makeText(TestActivity.this, "task is complete", Toast.LENGTH_SHORT).show();
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);

//        newTask();
    }

    private void newTask() {
//        Thread task = new Thread(new Runnable() {
//            @Override
//            public void run() {
//                try {
//                    Thread.sleep(60000);
//                    mHandler.obtainMessage(0).sendToTarget();
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                }
//
//            }
//        });
//
//        task.start();
    }

}
